package gui;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;
import java.awt.GridBagLayout;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.Rectangle;
import java.awt.Font;
import java.sql.SQLException;

import com.sun.rowset.CachedRowSetImpl;

import flexibility.CachedRowSetTableModel;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.table.DefaultTableModel;

public class AddFeedbackGUI extends JPanel{
	public JTable table;
	public JTable table_1;
	public JLabel lblNewLabel;
	public String AID;//ass id
	public String SID;//studentID
	public JButton btnDown;
	public JButton btnAddFeedback;
	public JButton btnAddCommant;
	public JButton btnBack;
	public AddFeedbackGUI() {
			super();
		
			initialize();
	}
	private void initialize() {
		this.setSize(900,600);
		this.setBackground(UIManager.getColor("InternalFrame.activeTitleBackground"));
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		
		JPanel panel = new JPanel();
		panel.setBackground(UIManager.getColor("InternalFrame.activeTitleBackground"));
		springLayout.putConstraint(SpringLayout.NORTH, panel, 30, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, panel, 51, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.SOUTH, panel, -24, SpringLayout.SOUTH, this);
		springLayout.putConstraint(SpringLayout.EAST, panel, -47, SpringLayout.EAST, this);
		add(panel);
		SpringLayout sl_panel = new SpringLayout();
		panel.setLayout(sl_panel);
		
		table = new JTable();
		table.setModel(new DefaultTableModel(
			new Object[][] {
			},
			new String[] {
				"New column", "New column", "New column", "New column"
			}
		));
		
		table.setEnabled(false);
		JScrollPane scrollPane = new JScrollPane(table);
		sl_panel.putConstraint(SpringLayout.NORTH, scrollPane, 30, SpringLayout.NORTH, panel);
		sl_panel.putConstraint(SpringLayout.WEST, scrollPane, 171, SpringLayout.WEST, panel);
		sl_panel.putConstraint(SpringLayout.SOUTH, scrollPane, -367, SpringLayout.SOUTH, panel);
		sl_panel.putConstraint(SpringLayout.EAST, scrollPane, -82, SpringLayout.EAST, panel);
		panel.add(scrollPane);
		
		table_1 = new JTable();
		table_1.setModel(new DefaultTableModel(
			new Object[][] {
				{null, null, null, null, null},
				{null, null, null, null, null},
			},
			new String[] {
				"student ID", "student First Name", "student Last Name", "Commit Date","Late Submission"
			}
		));
		
		table_1.setEnabled(false);
		JScrollPane scrollPane_1 = new JScrollPane(table_1);
		sl_panel.putConstraint(SpringLayout.WEST, scrollPane_1, 120, SpringLayout.WEST, panel);
		sl_panel.putConstraint(SpringLayout.SOUTH, scrollPane_1, -149, SpringLayout.SOUTH, panel);
		sl_panel.putConstraint(SpringLayout.EAST, scrollPane_1, 0, SpringLayout.EAST, scrollPane);
		panel.add(scrollPane_1);
		
		lblNewLabel = new JLabel("There are no submissions for this assignment");
		sl_panel.putConstraint(SpringLayout.NORTH, scrollPane_1, 6, SpringLayout.SOUTH, lblNewLabel);
		lblNewLabel.setIcon(new ImageIcon(AddFeedbackGUI.class.getResource("/com/sun/java/swing/plaf/windows/icons/Warn.gif")));
		lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 14));
		sl_panel.putConstraint(SpringLayout.SOUTH, lblNewLabel, -304, SpringLayout.SOUTH, panel);
		sl_panel.putConstraint(SpringLayout.WEST, lblNewLabel, 229, SpringLayout.WEST, panel);
		lblNewLabel.setForeground(Color.RED);
		panel.add(lblNewLabel);
		
		btnDown = new JButton("Download Submission");
		sl_panel.putConstraint(SpringLayout.NORTH, btnDown, 23, SpringLayout.SOUTH, scrollPane_1);
		sl_panel.putConstraint(SpringLayout.WEST, btnDown, 0, SpringLayout.WEST, scrollPane_1);
		btnDown.setFont(new Font("Tahoma", Font.BOLD, 13));
		panel.add(btnDown);
		btnDown.setEnabled(false);
		
		btnAddFeedback = new JButton("Upload Evaluation File");
		sl_panel.putConstraint(SpringLayout.NORTH, btnAddFeedback, 0, SpringLayout.NORTH, btnDown);
		sl_panel.putConstraint(SpringLayout.WEST, btnAddFeedback, 6, SpringLayout.EAST, btnDown);
		sl_panel.putConstraint(SpringLayout.EAST, btnAddFeedback, -306, SpringLayout.EAST, panel);
		btnAddFeedback.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		btnAddFeedback.setFont(new Font("Tahoma", Font.BOLD, 13));
		panel.add(btnAddFeedback);
		btnAddFeedback.setEnabled(false);
		
		btnAddCommant = new JButton("Upload Comments Files");
		sl_panel.putConstraint(SpringLayout.NORTH, btnAddCommant, 0, SpringLayout.NORTH, btnDown);
		sl_panel.putConstraint(SpringLayout.WEST, btnAddCommant, 21, SpringLayout.EAST, btnAddFeedback);
		sl_panel.putConstraint(SpringLayout.EAST, btnAddCommant, -92, SpringLayout.EAST, panel);
		btnAddCommant.setFont(new Font("Tahoma", Font.BOLD, 13));
		panel.add(btnAddCommant);
		btnAddCommant.setEnabled(false);
		
		btnBack = new JButton("Return to Courses ID List");
		btnBack.setFont(new Font("Tahoma", Font.BOLD, 14));
		
		sl_panel.putConstraint(SpringLayout.WEST, btnBack, 25, SpringLayout.WEST, panel);
		sl_panel.putConstraint(SpringLayout.SOUTH, btnBack, -28, SpringLayout.SOUTH, panel);
		panel.add(btnBack);
		
		lblNewLabel.setVisible(false);
		table_1.setVisible(false);
	}
}
